package com.xm.servlet.background.activity;

import com.xm.entity.Message;
import com.xm.service.background.MessageService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 活动Servlet
 *
 * @author 陈盼
 * @date 2023-12-28 下午 07:10
 */
@WebServlet("/background/get/activity")
public class GetActivityServlet extends HttpServlet {
    private final MessageService service = new MessageService();

    @SneakyThrows(Exception.class)
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)  {
        resp.setContentType("text/html;charset=utf-8");
        List<Message> messageList = service.getAll();
        req.setAttribute("messageList",messageList);
    }

}
